package com.dly.file;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileReaderTest {
	
	public static void main(String[] args) throws IOException {
		
		FileReader fr=new FileReader("D:/a.txt");
		FileWriter fw=new FileWriter("D:/c.txt");
		
		int a=0;
		char[] c=new char[1024*2];
		/*while((a=fr.read(c)) != -1){
			System.out.println(c);
			fw.write(c);
		}*/
		StringBuilder sb=new StringBuilder();
		int len=0;
		StringBuilder s=null;
		while((len=fr.read(c))!=-1){
//			s=sb.append(c);
			sb.append(c, 0, len);
			fw.write(c, 0, len);
		}
//		System.out.println(s);
		System.out.println(sb.toString());
		fr.close();
		fw.close();
		
	}
}
